package com.jcli.util;

import javax.swing.*;
import java.awt.*;

/**
 * @author li
 * @version 1.0
 * @belongsProject novel_20230923
 * @belongsPackage com.jcli.util
 * @className GUIUtil
 * @description TODO  界面设置
 * @createTime 2024-01-24  21:04
 */
public class GUIUtil {
    public static Font font = new Font("楷体",Font.BOLD,18);
    public static void useLNF() {
        try {
            // javax.swing.UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");
            // javax.swing.UIManager.setLookAndFeel("com.jtattoo.plaf.mcwin.McWinLookAndFeel");

            //        https://www.jb51.net/article/34175.htm
            //Java Swing 非常漂亮外观Nimbus的使用方法实例
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");

            // openai推荐的
            // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            // UIManager.put("swing.boldMetal", Boolean.FALSE); // 额外设置，可选
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    public static void showJPanel(String title, JPanel jp) {
        GUIUtil.useLNF();
        JFrame frame = new JFrame(title);
        frame.setBounds(400, 300, 600, 500);
        frame.add(jp);
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}
